package com.albert.java_log4j_demo;

import io.minio.MinioClient;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;

/**
 * @author 陈晖
 * @version 1.0
 * @date 2021/10/24 8:12
 */
public class MinIOUpload {
    public static void main(String[] args) {
        String filePath = "D:\\Hikvision\\PMS\\PMS\\PicStorage\\StorePicFile\\PassVehicle\\2021-09-17\\13\\Vehicle_20210917133849353_蓝闽JLF678_0.jpg";
        try (InputStream is = new BufferedInputStream(new FileInputStream(filePath))) {
            MinioClient minioClient = new MinioClient("http://121.204.170.206:9000/", "minioadmin", "minioadmin");
            minioClient.putObject("test", "-chen1024-demo.jpg", is, "image/jpg");
            System.out.println("http://121.204.170.206:9000" + "/" + "test" + "/" + "-chen1024-demo.jpg");
        } catch (Exception exception) {
            exception.printStackTrace();
        }

    }
}
